/*
 * @Description: 
 * @Author: Sun
 * @Date: 2024-08-03 10:36:57
 * @LastEditors: Sun
 * @LastEditTime: 2024-08-04 07:40:51
 */
let a2: object;
a2 = {}
a2 = function () {

}

// {} 用来指定对象中包含 哪些属性
// 语法:{属性名：属性值，属性名：属性值}
//加上问号？ 代表这个属性不是必须的
let a3: { name: string ,age?: number}
a3 = { name: "ss" }

// [xxx:string] 代表其他的字读 不做强制要求 任意类型属性
let a4: { name: string, [propName:string]:any}
a4 = { name: "sss", age9: 18 }

let d:(a:number,b:number)=>number

d=function(n1:number,n2:number){
  return 10
}

//字符串的数组|number
let a5:string[];
a5=["a","b","c"]

let a6:Array<number>;
a6 = [1,2,3]

let a61:number[]=[1,2,3]

// 元组 就是有固定长度的数组？[xx,xx]
 let a7:[string,string]
a7=["Aa","xx"]

//枚举 enum
enum gender {
  male=0,
  female=1
}

let a8: { name: string, gender: gender }
a8={
  name:"xxx",
  gender: gender.female
}

console.log("a8", a8.gender  )

// & 表示同时拥有
let j:{name:string} & {age:number}
j = { name: 'xxxx', age: 10 } 
console.log("j", j)

// 12 类型的别名
type mutype = 1 | 2 | 3 | 4 | 5 | 6;
let k: mutype;
let l: mutype;
l = 1;
k = 4;
console.log("k", k)

console.log("l", l)
